<!DOCTYPE html>
<!-- saved from url=(0027)http://www.hnjyxh.com/zcfg/ -->
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <title>作品上传-征集|写 珍湘酒广告语 赢美酒-中国·长沙酒文化节</title>
    <meta name="keywords" content="湖南省酒业协会 酒协 湖南酒业">
    <meta name="description" content="湖南省酒业协会">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/weui.min.css"/>
    <link rel="stylesheet" href="__STATIC__/home/jquery_weui/css/jquery-weui.min.css"/>
    {css href="__PUBLIC__static/home/css/jquery.jcrop.min.css"}
</head>
<body>
<form>
    <p style="text-align:center">
        <span style="font-size:1rem;font-weight: bold">珍湘酒广告语有奖征集</span>
    </p><br />
    <p style="text-align:center">
        <img src="/static/home/images/jyxh.jpg" style="width: 100%; height: auto;">
    </p>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" name="username" placeholder="请输入姓名">
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">手机号</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="tel" name="mobile" placeholder="请输入手机号">
            </div>
        </div>
    </div>
    <div class="weui-cells__title" style="color: #000;">珍湘广告</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea id="introduce" maxlength='20' class="weui-textarea area" name="advert" placeholder="请输入您的创意广告语" rows="3"></textarea>
            </div>
        </div>
        <div class="my-input1">
            <div class="weui-textarea-counter"><span id="lyishu">0</span>/20</div>
        </div>
    </div>

</form>
<div class="demos-content-padded" style="padding: 15px;">
    <a href="javascript:;" class="weui-btn weui-btn_primary send_form">提交作品</a>
</div>


<script src="__STATIC__/home/jquery_weui/js/jquery-2.1.4.js"></script>
<script src="__STATIC__/home/jquery_weui/js/jquery-weui.min.js"></script>
{js href="__PUBLIC__static/home/js/jquery.jcrop.min.js" /}
{js href="__PUBLIC__static/home/js/jquery.jcrop.upload.js" /}
{js href="__PUBLIC__static/home/js/exif.js" /}
<!--textarea的字数限制-->
<script>
    $(function () {
        //匹配包含给定属性的元素，keyup在按键释放时发生
        $("#introduce").keyup(function () {
            var area = $(this);
            //parseInt 方法返回与保存在 numString 中的数字值相等的整数。如果 numString 的前缀不能解释为整数，则返回 NaN（而不是数字）。
            var max = parseInt(area.attr("maxlength"), 10); //获取maxlength的值 转化为10进制，将输入到textarea的文本长度
            //这个判断可知max得到的是不是数字，设定的大小是多少
            if (max > 0) {

                if (area.val().length > max) { //textarea的文本长度大于maxlength
                    area.val(area.val().substr(0, max)); //截断textarea的文本重新赋值
                }

                var yishu = area.val().length;
                var sheng = max - area.val().length;
                $("#lyishu").html(yishu);
                $("#lsheng").html(sheng);
            }
        });
        $("#introduce").blur(function () {
            var area = $(this);
            var max = parseInt(area.attr("maxlength"), 10); //获取maxlength的值
            if (max > 0) {

                if (area.val().length > max) { //textarea的文本长度大于maxlength   s
                    area.val(area.val().substr(0, max)); //截断textarea的文本重新赋值
                }

                var yishu = area.val().length;
                var sheng = max - area.val().length;
                $("#lyishu").html(yishu);
                $("#lsheng").html(sheng);
            }
        });

    });

</script>
<script>
    var SCOPE = {};
    SCOPE.upload_img_max_num = 3;
    SCOPE.upload_img_url = "{:url('base/upload_image')}";

    $(function () {
        var stringTime = "2017-10-12 18:00:00";
        var end_time = Date.parse(new Date(stringTime))/1000;
        var now_time = Date.parse(new Date())/1000;
        /*if(now_time > end_time){
            //活动已结束
            window.location.href="http://www.hnjyxh.com/index/activity/zjjz_advert_end";
        }*/
        $(".send_form").click(function () {
            // 检查数据
            if (!$('input[name="username"]').val()) {
                $('input[name="username"]').focus();
                $.toptip('请输入您的姓名', 'error');
                return false;
            }
            if (!$('input[name="username"]').val().match(/^[\u4E00-\u9FA5]{2,4}$/)) {
                $('input[name="username"]').focus();
                $.toptip('姓名格式不正确', 'error');
                return false;
            }
            if (!$('input[name="mobile"]').val()) {
                $('input[name="mobile"]').focus();
                $.toptip('请输入您的手机号码', 'error');
                return false;
            }

            if (!$('input[name="mobile"]').val().match(/^1[3|4|5|7|8][0-9]\d{4,8}$/i)) {
                $.toptip('手机号码格式不正确', 'error');
                $('input[name="mobile"]').focus();
                return false;
            }

            if (!$('textarea').val()) {
                $('textarea').focus();
                $.toptip('请输入珍湘酒广告语', 'error');
                return false;
            }

            $.ajax({
                type : 'POST',
                url : '{:url("zjjz_advert")}',
                data : $('form').serialize(),
                dataType : 'json',
                success : function(msg) {
                    if (msg.code == 1) {
                        count = msg.count;//剩余抽奖次数
                        ids = msg.ids;//有效的未抽奖的广告id
                        $.toptip('提交成功，请等待审核', 'success');
                        setTimeout(function () {
                            window.location.reload();
                            if (confirm("是否现在去抽奖？")) {
                                window.location.href="http://jx.mgtvshop.com/wechat/xydzp/index/count/"+count+"/ids/"+ids+"/id/2.html";
                            }else{
                                window.location.href="http://www.hnjyxh.com/index/activity/info/id/343.html";
                            }
                        }, 888);
                    }else if(msg.code == -1){
                        $.toptip(msg.msg, 'error');
                    }else{
                        $.toptip(msg.advert, 'error');
                    }
                }
            });
        });
    });
</script>

</body>
</html>